﻿@model webui.ViewModel.V_Userinfo

@{ 

    var selectList1 = new SelectList(ViewBag.Role, "id", "rName");
    var selectList2 = new SelectList(ViewBag.Shops, "ID", "ShopName");

}

<script type="text/javascript" src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<style type="text/css">
    #modifyTb {
        width: 400px;
        border: 1px solid #0094ff;
        margin: 10px auto;
        border-collapse: collapse;
    }

        #modifyTb td, #modifyTb th {
            border: 1px solid #0094ff;
            padding: 4px;
        }
</style>
@using (Html.BeginForm())
{//BeginForm方法 如果没有通过参数 设置 提交的路径，那么就会直接拿当前访问的路径 当 action
    @Html.HiddenFor(model => model.id)
<table id="modifyTb">
    <tr>
        <td>@Html.LabelFor(model => model.loginname)</td>
        <td>@Html.TextBoxFor(model => model.loginname)</td>
        <td>@Html.ValidationMessageFor(model => model.loginname)</td>
    </tr>

    <tr>
        <td>@Html.LabelFor(model => model.username)</td>
        <td>@Html.TextBoxFor(model => model.username)</td>
        <td>@Html.ValidationMessageFor(model => model.username)</td>
    </tr>
    <tr>
        <td>@Html.LabelFor(model => model.downNum)</td>
        <td>@Html.TextBoxFor(model => model.downNum)</td>
        <td>@Html.ValidationMessageFor(model => model.downNum)</td>
    </tr>

    <tr>
        <td>@Html.LabelFor(model => model.pwd)</td>
        <td>@Html.EditorFor(model => model.pwd)</td>
        <td>@Html.ValidationMessageFor(model => model.pwd)</td>
    </tr>

    <tr>
        <td>@Html.LabelFor(model => model.gender)</td>
        <td>@Html.CheckBoxFor(model => model.gender)注： 打钩为男</td>
        <td>@Html.ValidationMessageFor(model => model.pwd)</td>
    </tr>

    @if (ViewBag.loginname == "admin")
    {
        <tr>
            <td>@Html.LabelFor(model => model.roleid)</td>
            <td>@Html.DropDownListFor(model => model.roleid, selectList1 as SelectList, new { @class = "form-control" })</td>
            <td>@Html.ValidationMessageFor(model => model.roleid)</td>
        </tr>

        <tr>
            <td>@Html.LabelFor(model => model.Shopid)</td>
            <td>@Html.DropDownListFor(model => model.Shopid, selectList2, new { @class = "form-control" })</td>
            <td>@Html.ValidationMessageFor(model => model.roleid)</td>
        </tr>
    }

    <tr>
        <td>@Html.LabelFor(model => model.remark)</td>
        <td>@Html.EditorFor(model => model.remark)</td>
        <td>@Html.ValidationMessageFor(model => model.remark)</td>
    </tr>


    <tr>
        <td colspan="3">
            <input type="submit" value="保存" />
        </td>
    </tr>
</table>
}
